package com.si.store.demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.SimpleAdapter;

import com.si.store.R;

public class DemoActivity extends Activity {
	private static final String[] COUNTRIES = new String[] { "Belgium",
        "France", "France_", "Italy", "Germany", "Spain" };
	private static final int[] ImageID={ 
		R.drawable.ic_2048,
		R.drawable.ic_candy_blast_free,
		R.drawable.ic_id_devices,
		R.drawable.ic_candy_eg,
		R.drawable.ic_candy_of_lang,
		R.drawable.ic_city_rider_new,
	};
	List<HashMap<String,String>> aList = new ArrayList<HashMap<String,String>>();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.demo_activity);
		ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowCustomEnabled(true);

        LayoutInflater inflator = (LayoutInflater) this
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflator.inflate(R.layout.actionbar, null);

        actionBar.setCustomView(v);
        for(int i=0;i<6;i++){
            HashMap<String, String> hm = new HashMap<String,String>();
            hm.put("txt", COUNTRIES[i]);
            hm.put("flag", Integer.toString(ImageID[i]) );
            aList.add(hm);
        }
        String []from = {"flag","txt"};
        int []to={R.id.thumb,R.id.title};
        SimpleAdapter adapter1 = new SimpleAdapter(this, aList, R.layout.item_search_autocomplete, from, to);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_dropdown_item_1line, COUNTRIES);
        CustomAutoCompleteTextView textView = (CustomAutoCompleteTextView) v.findViewById(R.id.editText1);
        textView.setAdapter(adapter1);

	}
}
